'''
#i.定义了一个学生类：属性:学号，姓名，年龄，性别，身高，体重，成绩，家庭地址，电话号码。行为：学习（要求参数传入学习的时间），玩游戏（要求参数传入游戏名），编程（要求参数传入写代码的行数），数的求和（要求参数用变长参数来做，返回求和结果）
class Student:
    def __init__(self,id,name,age,sex,height,weight,grade,address,tel):
        self.id=id
        self.name=name
        self.age=age
        self.sex=sex
        self.height=height
        self.weight=weight
        self.grade=grade
        self.address=address
        self.tel=tel
    def study(self,study_time):
        print(f"{self.name}学习时长：{study_time}")
    def play_games(self,game_name):
        print(f"{self.name}玩了{game_name}游戏。")
    def program(self,daima_lines):
        print(f"{self.name}编写了{daima_lines}行代码")
    def total_sum(self,*args):
        num=0
        for i in args:
            num+=i
        print(f"输入数的总和为：{num}")
student_1=Student(101,"张三",18,"男",180,80,90,"河南省郑州市",15908981453)
student_1.study(2)
student_1.play_games("王者荣耀")
student_1.program(3)
student_1.total_sum(1,2,3,4,5)

#ii.车类：属性：车型号，车轮数，车身颜色，车重量，油箱存储大小 。功能：跑（要求参数传入车的具体功能，比如越野，赛车）创建：法拉利，宝马，铃木，五菱，拖拉机对象
class car:
    def __init__(self,model_number,wheels_num,color,weight,store_num):
        self.model_number=model_number
        self.wheels_num=wheels_num
        self.color=color
        self.weight=weight
        self.store_num=store_num
    def run(self,function):
        print(f"{self.model_number}执行{function}功能")
ferrari = car("法拉利", 4, "红色", 1500, 80)
bmw = car("宝马", 4, "蓝色", 1600, 75)
suzuki = car("铃木", 4, "白色", 1200, 60)
wuling = car("五菱", 4, "银色", 1800, 70)
tractor = car("拖拉机", 6, "绿色", 3000, 100)

ferrari.run("赛车")
wuling.run("代步")

#iii.笔记本：属性：型号，待机时间，颜色，重量，cpu型号，内存大小，硬盘大小。  行为：打游戏（传入游戏的名称）,办公。
class notebook:
    def __init__(self,model,standby_time,color,weight,cpu_model,memory,hard_disk):
        self.model=model
        self.standby_time=standby_time
        self.color=color
        self.weight=weight
        self.cpu_model=cpu_model
        self.memory=memory
        self.hard_disk=hard_disk
    def play_games(self,game_name):
        print(f"使用{self.model}笔记本打游戏")
    def work(self):
        print(f"使用{self.model}笔记本办公")
notebook_1=notebook('联想',5,'灰色','1.29kg','‌锐龙7 8845HS','16GB LPDDR5x','1TB SSD')
notebook_1.play_games("王者荣耀")
notebook_1.work()

#iv.猴子类：属性：类别，性别，身体颜色，体重。行为：造火（要求传入造火的材料：比如木棍还是石头），学习事物（要求参数传入学习的具体事物，可以不止学习一种事物）
class monkey:
    def __init__(self,category,sex,color,weight):
        self.category=category
        self.sex=sex
        self.color=color
        self.weight=weight
    def make_fire(self,material):
        print(f"{self.category}猴子用{material}造火")
    def study(self,*args):
        for i in args:
            print(f"{self.category}猴子学习了{i}")
monkey_1=monkey('金丝猴','母','黄色','6kg')
monkey_1.make_fire("木棍")
monkey_1.study("玩手机","看书","吃香蕉")
'''

#编程2
class person:
    def __init__(self,name,sex,age,tele_charges,brand,battery_capacity,screen_num,max_standby_time,jifen):
        self.name=name
        self.sex=sex
        self.age=age
        self.tel_charges=tele_charges
        self.brand=brand
        self.battery_capacity=battery_capacity
        self.screen_num=screen_num
        self.max_standby_time=max_standby_time
        self.jifen=jifen
    def sent_massege(self,content):
        print(f"{self.name}发送短信，内容是：{content}")
    def phone(self,tel,time_length):
        if not tel:
            print("电话号码为空！")
        elif self.tel_charges<1:
            print("话费余额不足1元,无法拨通！")
        else:
            if 0<time_length<=10:
                self.jifen+=time_length*15
                self.tel_charges-=time_length
            elif 10<time_length<=20:
                self.jifen+=time_length*39
                self.tel_charges-=0.8*time_length
            else:
                self.jifen+=time_length*48
                self.tel_charges-=time_length*0.65
            print(f"您通话时长为：{time_length}分钟,目前话费余额为：{self.tel_charges}元,账户积分为:{self.jifen}")
person_1=person('李四','男',26,100,'华为','6000mAh','6.74英寸','15秒',0)
person_1.sent_massege("你好，我是李四")
person_1.phone(15477685453,15)
